package com.adong.pojo;

import org.springframework.beans.factory.FactoryBean;

import java.awt.*;

/**
 * @author adong
 * 创建一个Spring自定义的FactoryBean
 */
public class CarFactoryBean implements FactoryBean<Car> {
    //返回Car对象返回到到容器中
    @Override
    public Car getObject() throws Exception {
        return new Car();
    }

    @Override
    public Class<Car> getObjectType() {
        return Car.class;
    }

    //是单例 返回true是单例,容器中只保留一封
    //返回false,多实例,每次获取都会从中创建一份新的bean
    @Override
    public boolean isSingleton() {
        return false;
    }
}
